package com.example.demo.response;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @author wangxiaoyuan
 * 2020/9/23 14:27
 **/
@Data
@AllArgsConstructor
public class ApiResponse {
    private int code;
    private String msg;
    private Object data;

    public static ApiResponse success() {
        return new ApiResponse(0, "success", null);
    }

    public static ApiResponse success(Object data) {
        return new ApiResponse(0, "success", data);
    }

    public static ApiResponse error() {
        return new ApiResponse(-1, "error", null);
    }

    public static ApiResponse error(String msg) {
        return new ApiResponse(-1, msg, null);
    }
}
